projectNumAndName();
//JavaScript代码区域
layui.use('element', function(){
    var element = layui.element;
});

function initTable(table, str) {
    var cols = [];
    $("#table1+div").hide();
    switch (str) {
        case "项目编号名称定义表":
            cols = [
                [
                    {field: 'index', align: 'center', title: '序号', width:60},
                    {field: 'xmbh', align: 'center', title: '项目编号'},
                    {field: 'xmqc', align: 'center', title: '项目全称'},
                    {field: 'khmc', align: 'center', title: '客户名称'},
                    {field: 'xmlx', align: 'center', title: '项目类型'},
                ]
            ];
            break;
        case "员工薪酬明细表":
            cols =[
                [
                    {field: 'id', align: 'center', title: '序号：', rowspan: 3, totalRowText: '合计'},
                    {field: 'sfzh', align: 'center', title: '身份证号：', rowspan: 3,width:160},
                    {field: 'xm', align: 'center', title: '姓名', rowspan: 3},
                    {field: 'bm', align: 'center', title: '部门', rowspan: 3},
                    {align: 'center', title: '工资', colspan: 7},
                    {align: 'center', title: '单位负担五险一金', colspan: 8},
                    {field: 'zj', align: 'center', title: '总计', rowspan: 3,totalRow: true},
                ],
                [
                    {field: 'gzjbgz', align: 'center', title: '基本工资',rowspan: 2,totalRow: true},
                    {align: 'center', title: '各项补助',colspan: 3},
                    {field: 'gzjj', align: 'center', title: '奖金',rowspan: 2,totalRow: true},
                    {field: 'gzqt', align: 'center', title: '其他',rowspan: 2,totalRow: true},
                    {field: 'gzxj', align: 'center', title: '小计',rowspan: 2,totalRow: true},
                    {field: 'dwfdwxyjylbx', align: 'center', title: '养老保险',rowspan: 2,totalRow: false},
                    {field: 'dwfdwxyjsybx', align: 'center', title: '失业保险',rowspan: 2,totalRow: false},
                    {field: 'dwfdwxyjgsbx', align: 'center', title: '工伤保险',rowspan: 2,totalRow: false},
                    {field: 'dwfdwxyjyiliaobx', align: 'center', title: '医疗保险',rowspan: 2,totalRow: false},
                    {field: 'dwfdwxyjbcylbx', align: 'center', title: '补充医疗保险',rowspan: 2,totalRow: false},
                    {field: 'dwfdwxyjsyjj', align: 'center', title: '生育基金',rowspan: 2,totalRow: false},
                    {field: 'dwfdwxyjzfgjj', align: 'center', title: '住房公积金',rowspan: 2,totalRow: false},
                    {field: 'dwfdwxyjxgqjj', align: 'center', title: '香港强基金',rowspan: 2,totalRow: false},
                    {field: 'dwfdwxyjxj', align: 'center', title: '小计',rowspan: 2,totalRow: false},
                ],
                [
                    {field: 'gzgxbznqat', align: 'center', title: '内勤(按天)',totalRow: false},
                    {field: 'gzgxbzwqat', align: 'center', title: '外勤(按天)',totalRow: false},
                    {field: 'gzgxbzqtay', align: 'center', title: '其他(按月)',totalRow: false},
                ],
            ];
            break;
        case "员工项目工时归集表":
            cols = [
                [ //标题栏
                    {field: 'index', title: '序号：', rowspan: 2, totalRowText: '合计'},
                    {field: 'sfzh', title: '身份证号：', rowspan: 2,width:160},
                    {field: 'xm', title: '姓名', rowspan: 2},
                    {field: 'hjgs', title: '总工时', rowspan: 2,totalRow: true},
                    {align: 'center', title: '项目编号', colspan: 6},
                ],
                [
                    {field: 'projectNum1', title: '项目编号1'},
                    {field: 'projectNum2', title: '项目编号2'},
                    {field: 'projectNum3', title: '项目编号3'},
                    {field: 'projectNum4', title: '项目编号4'},
                    {field: 'projectNum5', title: '项目编号5'},
                    {field: 'projectNum6', title: '项目编号6'},
                ],
            ];
            break;
        case "员工项目工时分配率":
            cols = [
                [ //标题栏
                    {field: 'index', title: '序号：', rowspan: 2, totalRowText: '合计'},
                    {field: 'sfzh', title: '身份证号：', rowspan: 2,width:160},
                    {field: 'xm', title: '姓名', rowspan: 2},
                    {field: 'fplhj', title: '分配率合计', rowspan: 2,totalRow: true},
                    {align: 'center', title: '项目编号', colspan: 6},
                ],
                [
                    {field: 'projectNum1', title: '项目编号1'},
                    {field: 'projectNum2', title: '项目编号2'},
                    {field: 'projectNum3', title: '项目编号3'},
                    {field: 'projectNum4', title: '项目编号4'},
                    {field: 'projectNum5', title: '项目编号5'},
                    {field: 'projectNum6', title: '项目编号6'},
                ],
            ];
            break;
        case "项目人工成本分配表":
            cols = [
                [ //标题栏
                    {field: 'index', align: 'center', title: '序号：', rowspan: 3, totalRowText: '合计'},
                    {field: 'sfzh', align: 'center', title: '身份证号：', rowspan: 3,width:160},
                    {field: 'xm', align: 'center', title: '姓名', rowspan: 3},
                    {field: 'xmbh', align: 'center', title: '部门', rowspan: 3},
                    {align: 'center', align: 'center', title: '工资', colspan: 7},
                    {align: 'center', align: 'center', title: '单位负担五险一金', colspan: 8},
                    {field: 'zj', align: 'center', title: '总计', rowspan: 3,},
                ],
                [
                    {field: 'gzjbgz',  align: 'center', title: '基本工资',rowspan: 2,totalRow: true},
                    {align: 'center', title: '各项补助',colspan: 3,totalRow: true},
                    {field: 'gzjj',  align: 'center', title: '奖金',rowspan: 2,totalRow: true},
                    {field: 'gzqt',  align: 'center', title: '其他',rowspan: 2,totalRow: true},
                    {field: 'gzxj',  align: 'center', title: '小计',rowspan: 2},
                    {field: 'dwfdwxyjylbx',  align: 'center', title: '养老保险',rowspan: 2},
                    {field: 'dwfdwxyjsybx',  align: 'center', title: '失业保险',rowspan: 2},
                    {field: 'dwfdwxyjgsbx',  align: 'center', title: '工伤保险',rowspan: 2},
                    {field: 'dwfdwxyjyiliaobx',  align: 'center', title: '医疗保险',rowspan: 2},
                    {field: 'dwfdwxyjbcylbx',  align: 'center', title: '补充医疗保险',rowspan: 2},
                    {field: 'dwfdwxyjsyjj',  align: 'center', title: '生育基金',rowspan: 2},
                    {field: 'dwfdwxyjzfgjj',  align: 'center', title: '住房公积金',rowspan: 2},
                    {field: 'dwfdwxyjxgqjj',  align: 'center', title: '香港强基金',rowspan: 2},
                    {field: 'dwfdwxyjxj',  align: 'center', title: '小计',rowspan: 2},
                ],
                [
                    {field: 'gzgxbznqat',  align: 'center', title: '内勤(按天)'},
                    {field: 'gzgxbzwqat',  align: 'center', title: '外勤(按天)'},
                    {field: 'gzgxbzqtay',  align: 'center', title: '其他(按月)'},
                ],
            ];
            break;
        case "直接费用(非人工)归集汇总表":
            cols = [
                [
                    {field: 'index', align: 'center', title: '序号', width:60},
                    {field: 'xmbh', align: 'center', title: '项目编号'},
                    {field: 'xmqc', align: 'center', title: '项目全称'},
                    {field: 'khmc', align: 'center', title: '客户名称'},
                    {field: 'xmlx', align: 'center', title: '项目类型'},
                ]
            ];
            break;
        case "项目成本归集汇总表":
            cols = [
                [ //标题栏
                    {field: 'index', align: 'center', title: '序号：', rowspan: 2, totalRowText: '合计'},
                    {field: 'xmbh', align: 'center', title: '项目编号：', rowspan: 2},
                    {field: 'xmmc', align: 'center', title: '项目名称：', rowspan: 2},
                    {align: 'center', title: '直接人工', colspan: 12},
                    {align: 'center', title: '直接材料（含其他非人工直接费用）', colspan: 18},
                    {field: 'hj', align: 'center', title: '合计', rowspan: 2, templet:'<div>{{d.hj !=  null ? (d.hj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'projectNum1', align: 'center', title: '备注', rowspan: 2},
                ],
                [
                    {field: 'gzjbgz', align: 'center', title: '工资', templet:'<div>{{d.gzjbgz !=  null ? (d.gzjbgz / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'gzjj', align: 'center', title: '奖金', templet:'<div>{{d.gzjj !=  null ? (d.gzjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'dwfdwxyjylbx', align: 'center', title: '养老保险', templet:'<div>{{d.dwfdwxyjylbx !=  null ? (d.dwfdwxyjylbx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'dwfdwxyjsybx', align: 'center', title: '失业保险', templet:'<div>{{d.dwfdwxyjsybx !=  null ? (d.dwfdwxyjsybx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'dwfdwxyjgsbx', align: 'center', title: '工伤保险', templet:'<div>{{d.dwfdwxyjgsbx !=  null ? (d.dwfdwxyjgsbx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'dwfdwxyjyiliaobx', align: 'center', title: '医疗保险', templet:'<div>{{d.dwfdwxyjyiliaobx !=  null ? (d.dwfdwxyjyiliaobx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'dwfdwxyjbcylbx', align: 'center', title: '补充医疗保险', templet:'<div>{{d.dwfdwxyjbcylbx !=  null ? (d.dwfdwxyjbcylbx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'dwfdwxyjsyjj', align: 'center', title: '生育基金', templet:'<div>{{d.dwfdwxyjsyjj !=  null ? (d.dwfdwxyjsyjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'dwfdwxyjzfgjj', align: 'center', title: '住房公积金', templet:'<div>{{d.dwfdwxyjzfgjj !=  null ? (d.dwfdwxyjzfgjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'dwfdwxyjxgqjj', align: 'center', title: '香港强基金', templet:'<div>{{d.dwfdwxyjxgqjj !=  null ? (d.dwfdwxyjxgqjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'gzqt', align: 'center', title: '其他', templet:'<div>{{d.gzqt !=  null ? (d.gzqt / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'xj', align: 'center', title: '小计', templet:'<div>{{d.xj !=  null ? (d.xj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost1',  align: 'center', title: '材料费',rowspan: 2, templet:'<div>{{d.cost1 !=  null ? (d.cost1 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost2',  align: 'center', title: '外包服务费',rowspan: 2, templet:'<div>{{d.cost2 !=  null ? (d.cost2 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost3',  align: 'center', title: '房屋租赁费',rowspan: 2, templet:'<div>{{d.cost3 !=  null ? (d.cost3 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost4',  align: 'center', title: '差旅费',rowspan: 2, templet:'<div>{{d.cost4 !=  null ? (d.cost4 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost5',  align: 'center', title: '交通费',rowspan: 2, templet:'<div>{{d.cost5 !=  null ? (d.cost5 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost6',  align: 'center', title: '办公费',rowspan: 2, templet:'<div>{{d.cost6 !=  null ? (d.cost6 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost7',  align: 'center', title: '通讯费',rowspan: 2, templet:'<div>{{d.cost7 !=  null ? (d.cost7 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost8',  align: 'center', title: '劳务费',rowspan: 2, templet:'<div>{{d.cost8 !=  null ? (d.cost8 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost9',  align: 'center', title: '福利费',rowspan: 2, templet:'<div>{{d.cost9 !=  null ? (d.cost9 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost10',  align: 'center', title: '快递费',rowspan: 2, templet:'<div>{{d.cost10 !=  null ? (d.cost10 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost11',  align: 'center', title: '餐费',rowspan: 2, templet:'<div>{{d.cost11 !=  null ? (d.cost11 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost12',  align: 'center', title: '水电费',rowspan: 2, templet:'<div>{{d.cost12 !=  null ? (d.cost12 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost13',  align: 'center', title: '人身意外伤害险',rowspan: 2, templet:'<div>{{d.cost13 !=  null ? (d.cost13 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost14',  align: 'center', title: '差旅补助',rowspan: 2, templet:'<div>{{d.cost14 !=  null ? (d.cost14 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost15',  align: 'center', title: '低值易耗品',rowspan: 2, templet:'<div>{{d.cost15 !=  null ? (d.cost15 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost16',  align: 'center', title: '运输费、仓储费、包装费',rowspan: 2, templet:'<div>{{d.cost16 !=  null ? (d.cost16 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost17',  align: 'center', title: '资产折旧',rowspan: 2, templet:'<div>{{d.cost17 !=  null ? (d.cost17 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'costhj',  align: 'center', title: '小计',rowspan: 2, templet:'<div>{{d.costhj !=  null ? (d.costhj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                ],
            ];
            break;
        case "项目成本明细表":
            cols = [
                [ //标题栏
                    { align: 'center', title: '人工成本', colspan: 15},
                ],
                [ //标题栏
                    {field: 'index', align: 'center', title: '序号', totalRowText: '合计'},
                    {field: 'xmbh', align: 'center', title: '身份证号'},
                    {field: 'xm', align: 'center', title: '姓名'},
                    {field: 'xmgs', align: 'center', title: '工时'},
                    {field: 'xmjj', align: 'center', title: '奖金'},
                    {field: 'flf', align: 'center', title: '福利费'},
                    {field: 'flf', align: 'center', title: '养老保险'},
                    {field: 'flf', align: 'center', title: '失业保险'},
                    {field: 'flf', align: 'center', title: '医疗保险'},
                    {field: 'flf', align: 'center', title: '补充医疗保险'},
                    {field: 'flf', align: 'center', title: '工伤保险'},
                    {field: 'flf', align: 'center', title: '生育基金'},
                    {field: 'flf', align: 'center', title: '住房公积金'},
                    {field: 'flf', align: 'center', title: '其他'},
                    {field: 'flf', align: 'center', title: '合计'},
                ]
            ];
            table.render({
                elem: '#table1',
                toolbar: true,
                defaultToolbar: ['exports'],
                data:[{}],
                // limits:[10, 20, 50, 100],
                cellMinWidth: 120, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                cols:[
                    [ //标题栏
                        { align: 'center', title: '直接费用(非人工)', colspan: 15},
                    ],[ //标题栏
                        {field: 'cost0', align: 'center', title: '项目'},
                        {field: 'cost1',  align: 'center', title: '材料费',templet:'<div>{{d.cost1 !=  null ? (d.cost1 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost2',  align: 'center', title: '外包服务费',templet:'<div>{{d.cost2 !=  null ? (d.cost2 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost3',  align: 'center', title: '房屋租赁费',templet:'<div>{{d.cost3 !=  null ? (d.cost3 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost4',  align: 'center', title: '差旅费',templet:'<div>{{d.cost4 !=  null ? (d.cost4 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost5',  align: 'center', title: '交通费',templet:'<div>{{d.cost5 !=  null ? (d.cost5 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost6',  align: 'center', title: '办公费',templet:'<div>{{d.cost6 !=  null ? (d.cost6 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost7',  align: 'center', title: '通讯费',templet:'<div>{{d.cost7 !=  null ? (d.cost7 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost8',  align: 'center', title: '劳务费',templet:'<div>{{d.cost8 !=  null ? (d.cost8 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost9',  align: 'center', title: '福利费',templet:'<div>{{d.cost9 !=  null ? (d.cost9 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost10',  align: 'center', title: '快递费',templet:'<div>{{d.cost10 !=  null ? (d.cost10 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost11',  align: 'center', title: '餐费',templet:'<div>{{d.cost11 !=  null ? (d.cost11 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost12',  align: 'center', title: '水电费',templet:'<div>{{d.cost12 !=  null ? (d.cost12 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost13',  align: 'center', title: '人身意外伤害险',templet:'<div>{{d.cost13 !=  null ? (d.cost13 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost14',  align: 'center', title: '差旅补助',templet:'<div>{{d.cost14 !=  null ? (d.cost14 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost15',  align: 'center', title: '低值易耗品',templet:'<div>{{d.cost15 !=  null ? (d.cost15 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost16',  align: 'center', title: '运输费、仓储费、包装费',templet:'<div>{{d.cost16 !=  null ? (d.cost16 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'cost17',  align: 'center', title: '资产折旧',templet:'<div>{{d.cost17 !=  null ? (d.cost17 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        {field: 'costhj',  align: 'center', title: '小计',templet:'<div>{{d.costhj !=  null ? (d.costhj / 1).toFixed(2) : ""}}</div>', totalRow: true,style:'background-color: #B7DEE8;',minWidth: 255}
                    ],
                ],
            });
            break;
        default:
            break;
    }
    table.render({
        elem: '#table',
        toolbar: true, //开启头部工具栏，并为其绑定左侧模板
        defaultToolbar: ['exports'],
        data:[{}],
        cellMinWidth: 120, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
        cols:cols,
    });
}
// 项目编号名称定义表
function projectNumAndName(){
    $("#tableTitle").html("项目编号名称定义表");
    $(".Ygxcmxb").hide();
    layui.use('table', function(){
        var table = layui.table;
        initTable(table, '项目编号名称定义表');
        $.ajax({
            type: 'POST',
            url: '/report/xmbhmcdyb.json',
            dataType:"json",
            contentType: "application/json; charset=utf-8",
            success: function(result){
                if(result.success){
                    var data = result.data.map((item,index) => {
                        item.index = index + 1;
                        return item
                    });
                    var length = data.length;
                    table.render({
                        elem: '#table',
                        title: '项目编号名称定义表',
                        toolbar: true, //开启头部工具栏，并为其绑定左侧模板
                        defaultToolbar: ['filter', 'exports'],
                        data:data,
                        limits:[10, 20, 50, 100, length],
                        cellMinWidth: 120, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                        cols:[
                            [
                                {field: 'index', align: 'center', title: '序号', width:60},
                                {field: 'xmbh', align: 'center', title: '项目编号'},
                                {field: 'xmqc', align: 'center', title: '项目全称'},
                                {field: 'khmc', align: 'center', title: '客户名称'},
                                {field: 'xmlx', align: 'center', title: '项目类型'},
                            ]
                        ],
                        page:true
                    });
                }
            }
        })


    });
}
// 员工薪酬明细表
function projectYgxcmxb(){
    $("#tableTitle").html("员工薪酬明细表");
    $(".Ygxcmxb").show();
    $(".bottomTxT_1").html("编制人员：");
    $(".bottomTxT_2").html("复核人员：");
    $(".bottomTxT_3").html("主管领导：");
    $(".bottomTxT_4").html("编制日期：");
    $(".bottomTxT_5").html("复核日期：");
    $(".bottomTxT_6").html("审批日期：");

    layui.use('table', function(){
        var table = layui.table;
        initTable(table, '员工薪酬明细表');
        $.ajax({
            type: 'POST',
            url: '/report/ygxcmxb.json',
            dataType:"json",
            contentType: "application/json; charset=utf-8",
            success: function(result){
                if(result.success){
                    var data = result.data.map((item,index) => {
                        item.index = index + 1;
                        return item
                    });
                    var length = data.length;
                    table.render({
                        elem: '#table',
                        title: '员工薪酬明细表',
                        toolbar: true, //开启头部工具栏，并为其绑定左侧模板
                        defaultToolbar: ['filter', 'exports'],
                        data:data,
                        limits:[10, 20, 50, 100, length],
                        cellMinWidth: 120, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                        cols:[
                            [
                                {field: 'index', align: 'center', title: '序号：', rowspan: 3, totalRowText: '合计'},
                                {field: 'sfzh', align: 'center', title: '身份证号：', rowspan: 3,width:160},
                                {field: 'xm', align: 'center', title: '姓名', rowspan: 3},
                                {field: 'bm', align: 'center', title: '部门', rowspan: 3},
                                {align: 'center', title: '工资', colspan: 7},
                                {align: 'center', title: '单位负担五险一金', colspan: 8},
                                {field: 'zj', align: 'center', title: '总计', rowspan: 3,totalRow: true},
                            ],
                            [
                                {field: 'gzjbgz', align: 'center', title: '基本工资',rowspan: 2, templet:'<div>{{d.gzjbgz !=  null ? (d.gzjbgz / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {align: 'center', title: '各项补助',colspan: 3},
                                {field: 'gzjj', align: 'center', title: '奖金',rowspan: 2, templet:'<div>{{d.gzjj !=  null ? (d.gzjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'gzqt', align: 'center', title: '其他',rowspan: 2, templet:'<div>{{d.gzqt !=  null ? (d.gzqt / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'gzxj', align: 'center', title: '小计',rowspan: 2, templet:'<div>{{d.gzxj !=  null ? (d.gzxj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjylbx', align: 'center', title: '养老保险',rowspan: 2, templet:'<div>{{d.dwfdwxyjylbx !=  null ? (d.dwfdwxyjylbx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjsybx', align: 'center', title: '失业保险',rowspan: 2, templet:'<div>{{d.dwfdwxyjsybx !=  null ? (d.dwfdwxyjsybx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjgsbx', align: 'center', title: '工伤保险',rowspan: 2, templet:'<div>{{d.dwfdwxyjgsbx !=  null ? (d.dwfdwxyjgsbx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjyiliaobx', align: 'center', title: '医疗保险',rowspan: 2, templet:'<div>{{d.dwfdwxyjyiliaobx !=  null ? (d.dwfdwxyjyiliaobx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjbcylbx', align: 'center', title: '补充医疗保险',rowspan: 2, templet:'<div>{{d.dwfdwxyjbcylbx !=  null ? (d.dwfdwxyjbcylbx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjsyjj', align: 'center', title: '生育基金',rowspan: 2, templet:'<div>{{d.dwfdwxyjsyjj !=  null ? (d.dwfdwxyjsyjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjzfgjj', align: 'center', title: '住房公积金',rowspan: 2, templet:'<div>{{d.dwfdwxyjzfgjj !=  null ? (d.dwfdwxyjzfgjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjxgqjj', align: 'center', title: '香港强基金',rowspan: 2, templet:'<div>{{d.dwfdwxyjxgqjj !=  null ? (d.dwfdwxyjxgqjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjxj', align: 'center', title: '小计',rowspan: 2, templet:'<div>{{d.dwfdwxyjxj !=  null ? (d.dwfdwxyjxj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            ],
                            [
                                {field: 'gzgxbznqat', align: 'center', title: '内勤(按天)', templet:'<div>{{d.gzgxbznqat !=  null ? (d.gzgxbznqat / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'gzgxbzwqat', align: 'center', title: '外勤(按天)', templet:'<div>{{d.gzgxbzwqat !=  null ? (d.gzgxbzwqat / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'gzgxbzqtay', align: 'center', title: '其他(按月)', templet:'<div>{{d.gzgxbzqtay !=  null ? (d.gzgxbzqtay / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            ],
                        ],
                        totalRow:true,
                        page: true
                    });
                }
            }
        })
    });
}
// 员工项目工时归集表
function projectYgxmgsgjb(){
    $("#tableTitle").html("员工项目工时归集表");
    $(".Ygxcmxb").show();
    $(".bottomTxT_1").html("编制人员：");
    $(".bottomTxT_2").html("复核人员：");
    $(".bottomTxT_3").html("部门经理：");
    $(".bottomTxT_4").html("审核日期：");
    $(".bottomTxT_5").html("人事主管：");
    $(".bottomTxT_6").html("审批日期：");
    layui.use('table', function(){
        var table = layui.table;
        initTable(table, '员工项目工时归集表');

        $.ajax({
            type: 'POST',
            url: '/report/xmbhmcdyb.json',
            dataType:"json",
            contentType: "application/json; charset=utf-8",
            success: function(result){
                if(result.success){
                    var projectNameData = result.data;
                    $.ajax({
                        type: 'POST',
                        url: '/report/ygxmgsgjb.json',
                        dataType:"json",
                        contentType: "application/json; charset=utf-8",
                        success: function(result){
                            if(result.success){
                                var data = result.data.list.map((item,index) => {
                                    item.index = index + 1;
                                    for (var i in item.xmbhgs) {
                                        item[i] = item.xmbhgs[i]
                                    }
                                    return item
                                });
                                var col = result.data.xmbh.map(item => {
                                    var projectName = item
                                    projectNameData.forEach(projectItem => {
                                        if (projectItem.xmbh == item) {
                                            projectName = item + '(' + projectItem.xmqc + ')';
                                        }
                                    });
                                    return {
                                        field: item,
                                        title: projectName
                                    }
                                });
                                var colspan = col.length;
                                var length = data.length;
                                table.render({
                                    elem: '#table',
                                    title: '员工项目工时归集表',
                                    toolbar: true, //开启头部工具栏，并为其绑定左侧模板
                                    defaultToolbar: ['filter', 'exports'],
                                    data:data,
                                    limits:[10, 20, 50, 100, length],
                                    cellMinWidth: 120, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                                    cols:[
                                        [
                                            {field: 'index', align: 'center', title: '序号：', rowspan: 2, totalRowText: '合计'},
                                            {field: 'sfzh', align: 'center', title: '身份证号：', rowspan: 2,width:160},
                                            {field: 'xm', align: 'center', title: '姓名', rowspan: 2},
                                            {field: 'hjgs', align: 'center', title: '总工时', rowspan: 2},
                                            {align: 'center', title: '项目编号', colspan: colspan},
                                        ],
                                        col
                                    ],
                                    totalRow:true,
                                    page: true
                                });

                            }
                        }
                    })
                }
            }
        })
    });
}
// 员工项目工时分配率
function projectYgxmgsfpl(){
    $("#tableTitle").html("员工项目工时分配率");
    $(".Ygxcmxb").show();
    $(".bottomTxT_1").html("编制人员：");
    $(".bottomTxT_2").html("复核人员：");
    $(".bottomTxT_3").html("部门经理：");
    $(".bottomTxT_4").html("审核日期：");
    $(".bottomTxT_5").html("人事主管：");
    $(".bottomTxT_6").html("审批日期：");
    layui.use('table', function(){
        var table = layui.table;
        initTable(table, '员工项目工时分配率');

        $.ajax({
            type: 'POST',
            url: '/report/xmbhmcdyb.json',
            dataType:"json",
            contentType: "application/json; charset=utf-8",
            success: function(result){
                if(result.success){
                    var projectNameData = result.data;
                    $.ajax({
                        type: 'POST',
                        url: '/report/ygxmgsfpl.json',
                        dataType:"json",
                        contentType: "application/json; charset=utf-8",
                        success: function(result){
                            if(result.success){
                                var data = result.data.list.map((item,index) => {
                                    item.index = index + 1;
                                    for (var i in item.xmbhgs) {
                                        var num = item.xmbhgs[i] !=  null ? (item.xmbhgs[i] / 1).toFixed(4) : ""
                                        if (num / 1) {
                                            item[i] = (num * 100).toFixed(2) + "%"
                                        } else {
                                            item[i] = num / 1
                                        }
                                    }
                                    return item
                                });
                                var col = result.data.xmbh.map(item => {
                                    var projectName = item;
                                    projectNameData.forEach(projectItem => {
                                        if (projectItem.xmbh == item) {
                                            projectName = item + '(' + projectItem.xmqc + ')';
                                        }
                                    });
                                    return {
                                        field: item,
                                        title: projectName,
                                    }
                                });
                                var colspan = col.length;
                                var length = data.length;
                                table.render({
                                    elem: '#table',
                                    title: '员工项目工时分配率',
                                    toolbar: true, //开启头部工具栏，并为其绑定左侧模板
                                    defaultToolbar: ['filter', 'exports'],
                                    data:data,
                                    limits:[10, 20, 50, 100, length],
                                    cellMinWidth: 120, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                                    cols:[
                                        [
                                            {field: 'index', align: 'center', title: '序号：', rowspan: 2, totalRowText: '合计'},
                                            {field: 'sfzh', align: 'center', title: '身份证号：', rowspan: 2,width:160},
                                            {field: 'xm', align: 'center', title: '姓名', rowspan: 2},
                                            {field: 'hjbl', align: 'center', title: '分配率合计', rowspan: 2, templet:'<div>{{d.hjbl !=  null ? ((d.hjbl * 100).toFixed() + "%") : ""}}</div>'},
                                            {align: 'center', title: '项目编号', colspan: colspan},
                                        ],
                                        col
                                    ],
                                    totalRow:true,
                                    page: true
                                });

                            }
                        }
                    })
                }
            }
        })
    });
}
// 项目人工成本分配表
function projectYgrgcbfpb(){
    $("#tableTitle").html("项目人工成本分配表");
    $(".Ygxcmxb").show();
    $(".bottomTxT_1").html("编制人员：");
    $(".bottomTxT_2").html("复核人员：");
    $(".bottomTxT_3").html("部门经理：");
    $(".bottomTxT_4").html("审核日期：");
    $(".bottomTxT_5").html("主管领导：");
    $(".bottomTxT_6").html("审批日期：");
    layui.use('table', function(){
        var table = layui.table;
        initTable(table, '项目人工成本分配表');

        $.ajax({
            type: 'POST',
            url: '/report/xmrgcbfpb.json',
            dataType:"json",
            contentType: "application/json; charset=utf-8",
            success: function(result){
                if(result.success){
                    var data = result.data.map((item,index) => {
                        item.index = index + 1;
                        return item
                    });
                }
                var length = data.length;
                table.render({
                    elem: '#table',
                    title: '项目人工成本分配表',
                    toolbar: true, //开启头部工具栏，并为其绑定左侧模板
                    defaultToolbar: ['filter', 'exports'],
                    data:data,
                    limits:[10, 20, 50, 100, length],
                    cellMinWidth: 120, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                    cols:[
                        [ //标题栏
                            {field: 'index', align: 'center', title: '序号：', rowspan: 3, totalRowText: '合计'},
                            {field: 'sfzh', align: 'center', title: '身份证号：', rowspan: 3,width:160},
                            {field: 'xm', align: 'center', title: '姓名', rowspan: 3},
                            {field: 'xmbh', align: 'center', title: '项目编号', rowspan: 3},
                            {align: 'center', align: 'center', title: '工资', colspan: 7},
                            {align: 'center', align: 'center', title: '单位负担五险一金', colspan: 9},
                            {field: 'zj', align: 'center', title: '总计', rowspan: 3},
                        ],
                        [
                            {field: 'gzjbgz',  align: 'center', title: '基本工资',rowspan: 2, templet:'<div>{{d.gzjbgz !=  null ? (d.gzjbgz / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {align: 'center', title: '各项补助',colspan: 3},
                            {field: 'gzjj',  align: 'center', title: '奖金',rowspan: 2, templet:'<div>{{d.gzjj !=  null ? (d.gzjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'gzqt',  align: 'center', title: '其他',rowspan: 2, templet:'<div>{{d.gzqt !=  null ? (d.gzqt / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'gzxj',  align: 'center', title: '小计',rowspan: 2, templet:'<div>{{d.gzxj !=  null ? (d.gzxj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'dwfdwxyjylbx',  align: 'center', title: '养老保险',rowspan: 2, templet:'<div>{{d.dwfdwxyjylbx !=  null ? (d.dwfdwxyjylbx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'dwfdwxyjsybx',  align: 'center', title: '失业保险',rowspan: 2, templet:'<div>{{d.dwfdwxyjsybx !=  null ? (d.dwfdwxyjsybx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'dwfdwxyjgsbx',  align: 'center', title: '工伤保险',rowspan: 2, templet:'<div>{{d.dwfdwxyjgsbx !=  null ? (d.dwfdwxyjgsbx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'dwfdwxyjyiliaobx',  align: 'center', title: '医疗保险',rowspan: 2, templet:'<div>{{d.dwfdwxyjyiliaobx !=  null ? (d.dwfdwxyjyiliaobx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'dwfdwxyjbcylbx',  align: 'center', title: '补充医疗保险',rowspan: 2, templet:'<div>{{d.dwfdwxyjbcylbx !=  null ? (d.dwfdwxyjbcylbx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'dwfdwxyjsyjj',  align: 'center', title: '生育基金',rowspan: 2, templet:'<div>{{d.dwfdwxyjsyjj !=  null ? (d.dwfdwxyjsyjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'dwfdwxyjzfgjj',  align: 'center', title: '住房公积金',rowspan: 2, templet:'<div>{{d.dwfdwxyjzfgjj !=  null ? (d.dwfdwxyjzfgjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'dwfdwxyjxgqjj',  align: 'center', title: '香港强基金',rowspan: 2, templet:'<div>{{d.dwfdwxyjxgqjj !=  null ? (d.dwfdwxyjxgqjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'dwfdwxyjxj',  align: 'center', title: '小计',rowspan: 2, templet:'<div>{{d.dwfdwxyjxj !=  null ? (d.dwfdwxyjxj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        ],
                        [
                            {field: 'gzgxbznqat',  align: 'center', title: '内勤(按天)', templet:'<div>{{d.gzgxbznqat !=  null ? (d.gzgxbznqat / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'gzgxbzwqat',  align: 'center', title: '外勤(按天)', templet:'<div>{{d.gzgxbzwqat !=  null ? (d.gzgxbzwqat / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'gzgxbzqtay',  align: 'center', title: '其他(按月)', templet:'<div>{{d.gzgxbzqtay !=  null ? (d.gzgxbzqtay / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        ],
                    ],
                    totalRow:true,
                    page: true
                });
            }
        })
    });
}
// 直接费用(非人工)归集汇总表
function projectZjfyfrggjhzb(){
    $("#tableTitle").html("直接费用(非人工)归集汇总表");
    $(".Ygxcmxb").show();
    $(".bottomTxT_1").html("编制人员：");
    $(".bottomTxT_2").html("复核人员：");
    $(".bottomTxT_3").html("部门经理：");
    $(".bottomTxT_4").html("复核日期：");
    $(".bottomTxT_5").html("主管领导：");
    $(".bottomTxT_6").html("审批日期：");
    layui.use('table', function(){
        var table = layui.table;
        initTable(table, '直接费用(非人工)归集汇总表');

        $.ajax({
            type: 'POST',
            url: '/report/zjfyfrggjhzb.json',
            dataType:"json",
            contentType: "application/json; charset=utf-8",
            success: function(result){
                if(result.success){
                    var data = result.data.map((item,index) => {
                        item.index = index + 1;
                        return item
                    });
                }

                var length = data.length;
                table.render({
                    elem: '#table',
                    title: '直接费用(非人工)归集汇总表',
                    toolbar: true, //开启头部工具栏，并为其绑定左侧模板
                    defaultToolbar: ['filter', 'exports'],
                    data:data,
                    limits:[10, 20, 50, 100, length],
                    cellMinWidth: 120, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                    cols:[
                        [ //标题栏
                            {field: 'index', align: 'center', title: '序号：', rowspan: 2, totalRowText: '合计'},
                            {field: 'xmbh', align: 'center', title: '项目编号：', rowspan: 2},
                            {field: 'xmmc', align: 'center', title: '项目名称', rowspan: 2},
                            {field: 'xmbh', align: 'center', title: '部门', rowspan: 2},
                            {align: 'center', align: 'center', title: '直接费用', colspan: 17},
                        ],
                        /*1材料费、2外包服务费、3房屋租赁费、4差旅费、5交通费、6办公费、7通讯费、8劳务费、9福利费、10快递费、11餐费、12水电费、13人身意外伤害险、14差旅补助、15低值易耗品、16运输费、仓储费、包装费、17资产折旧*/
                        [
                            {field: 'cost1',  align: 'center', title: '材料费',rowspan: 2, templet:'<div>{{d.cost1 !=  null ? (d.cost1 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost2',  align: 'center', title: '外包服务费',rowspan: 2, templet:'<div>{{d.cost2 !=  null ? (d.cost2 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost3',  align: 'center', title: '房屋租赁费',rowspan: 2, templet:'<div>{{d.cost3 !=  null ? (d.cost3 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost4',  align: 'center', title: '差旅费',rowspan: 2, templet:'<div>{{d.cost4 !=  null ? (d.cost4 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost5',  align: 'center', title: '交通费',rowspan: 2, templet:'<div>{{d.cost5 !=  null ? (d.cost5 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost6',  align: 'center', title: '办公费',rowspan: 2, templet:'<div>{{d.cost6 !=  null ? (d.cost6 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost7',  align: 'center', title: '通讯费',rowspan: 2, templet:'<div>{{d.cost7 !=  null ? (d.cost7 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost8',  align: 'center', title: '劳务费',rowspan: 2, templet:'<div>{{d.cost8 !=  null ? (d.cost8 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost9',  align: 'center', title: '福利费',rowspan: 2, templet:'<div>{{d.cost9 !=  null ? (d.cost9 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost10',  align: 'center', title: '快递费',rowspan: 2, templet:'<div>{{d.cost10 !=  null ? (d.cost10 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost11',  align: 'center', title: '餐费',rowspan: 2, templet:'<div>{{d.cost11 !=  null ? (d.cost11 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost12',  align: 'center', title: '水电费',rowspan: 2, templet:'<div>{{d.cost12 !=  null ? (d.cost12 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost13',  align: 'center', title: '人身意外伤害险',rowspan: 2, templet:'<div>{{d.cost13 !=  null ? (d.cost13 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost14',  align: 'center', title: '差旅补助',rowspan: 2, templet:'<div>{{d.cost14 !=  null ? (d.cost14 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost15',  align: 'center', title: '低值易耗品',rowspan: 2, templet:'<div>{{d.cost15 !=  null ? (d.cost15 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost16',  align: 'center', title: '运输费、仓储费、包装费',rowspan: 2, templet:'<div>{{d.cost16 !=  null ? (d.cost16 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                            {field: 'cost17',  align: 'center', title: '资产折旧',rowspan: 2, templet:'<div>{{d.cost17 !=  null ? (d.cost17 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                        ],
                    ],
                    totalRow:true,
                    page:true
                });
            }
        })
    });
}
// 项目成本归集汇总表
function projectXmcbgihzb(){
    $("#tableTitle").html("项目成本归集汇总表");
    $(".Ygxcmxb").show();
    $(".bottomTxT_1").html("编制人员：");
    $(".bottomTxT_2").html("复核人员：");
    $(".bottomTxT_3").html("主管财务经理：");
    $(".bottomTxT_4").html("复核日期：");
    $(".bottomTxT_5").html("主管领导：");
    $(".bottomTxT_6").html("审批日期：");
    layui.use('table', function(){
        var table = layui.table;
        initTable(table, '项目成本归集汇总表');
        $.ajax({
            type: 'POST',
            url: '/report/xmcbgjhzb.json',
            dataType:"json",
            contentType: "application/json; charset=utf-8",
            success: function(result){
                if(result.success){
                    // var cols = col1.concat(col2, col3, col4);
                    var  data = result.data.map((item,index) => {
                        item.index = index + 1;
                        for (var i in item.model) {
                            if (typeof item.model[i] == 'string'){
                                item[i] = item.model[i]
                            } else {
                                var num = item.model[i] !=  null ? (item.model[i] / 1).toFixed(2) : "";
                                if (i == 'hj') {
                                    item['costhj'] = num / 1
                                } else {
                                    item[i] = num / 1
                                }

                            }
                        }
                        return item
                    });
                    var length = data.length;
                    table.render({
                        elem: '#table',
                        title: '项目成本归集汇总表',
                        toolbar: '#toolbarDemo', //开启头部工具栏，并为其绑定左侧模板
                        defaultToolbar: ['filter', 'exports'],
                        data:data,
                        limits:[10, 20, 50, 100, length],
                        cellMinWidth: 120, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                        cols:[
                            [ //标题栏
                                {field: 'index', align: 'center', title: '序号：', rowspan: 2, totalRowText: '合计'},
                                {field: 'xmbh', align: 'center', title: '项目编号：', rowspan: 2},
                                {field: 'xmmc', align: 'center', title: '项目名称：', rowspan: 2},
                                {field: 'zjrg', align: 'center', title: '直接人工', colspan: 12}, // 12
                                {field: 'zjcl', align: 'center', title: '直接材料（含其他非人工直接费用）', colspan: 18}, // 18
                                {field: 'hj', align: 'center', title: '合计', rowspan: 2, templet:'<div>{{d.hj !=  null ? (d.hj / 1).toFixed(2) : ""}}</div>', totalRow: true,style:'background-color: #FABF8F;'},
                                {field: 'projectNum1', align: 'center', title: '备注', rowspan: 2},
                            ],
                            [
                                {field: 'gzjbgz', align: 'center', title: '工资', templet:'<div>{{d.gzjbgz !=  null ? (d.gzjbgz / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'gzjj', align: 'center', title: '奖金', templet:'<div>{{d.gzjj !=  null ? (d.gzjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjylbx', align: 'center', title: '养老保险', templet:'<div>{{d.dwfdwxyjylbx !=  null ? (d.dwfdwxyjylbx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjsybx', align: 'center', title: '失业保险', templet:'<div>{{d.dwfdwxyjsybx !=  null ? (d.dwfdwxyjsybx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjgsbx', align: 'center', title: '工伤保险', templet:'<div>{{d.dwfdwxyjgsbx !=  null ? (d.dwfdwxyjgsbx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjyiliaobx', align: 'center', title: '医疗保险', templet:'<div>{{d.dwfdwxyjyiliaobx !=  null ? (d.dwfdwxyjyiliaobx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjbcylbx', align: 'center', title: '补充医疗保险', templet:'<div>{{d.dwfdwxyjbcylbx !=  null ? (d.dwfdwxyjbcylbx / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjsyjj', align: 'center', title: '生育基金', templet:'<div>{{d.dwfdwxyjsyjj !=  null ? (d.dwfdwxyjsyjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjzfgjj', align: 'center', title: '住房公积金', templet:'<div>{{d.dwfdwxyjzfgjj !=  null ? (d.dwfdwxyjzfgjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'dwfdwxyjxgqjj', align: 'center', title: '香港强基金', templet:'<div>{{d.dwfdwxyjxgqjj !=  null ? (d.dwfdwxyjxgqjj / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'gzqt', align: 'center', title: '其他', templet:'<div>{{d.gzqt !=  null ? (d.gzqt / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'xj', align: 'center', title: '小计', templet:'<div>{{d.xj !=  null ? (d.xj / 1).toFixed(2) : ""}}</div>', totalRow: true,style:'background-color: #C4D79B;'},
                                {field: 'cost1',  align: 'center', title: '材料费',rowspan: 2, templet:'<div>{{d.cost1 !=  null ? (d.cost1 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost2',  align: 'center', title: '外包服务费',rowspan: 2, templet:'<div>{{d.cost2 !=  null ? (d.cost2 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost3',  align: 'center', title: '房屋租赁费',rowspan: 2, templet:'<div>{{d.cost3 !=  null ? (d.cost3 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost4',  align: 'center', title: '差旅费',rowspan: 2, templet:'<div>{{d.cost4 !=  null ? (d.cost4 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost5',  align: 'center', title: '交通费',rowspan: 2, templet:'<div>{{d.cost5 !=  null ? (d.cost5 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost6',  align: 'center', title: '办公费',rowspan: 2, templet:'<div>{{d.cost6 !=  null ? (d.cost6 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost7',  align: 'center', title: '通讯费',rowspan: 2, templet:'<div>{{d.cost7 !=  null ? (d.cost7 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost8',  align: 'center', title: '劳务费',rowspan: 2, templet:'<div>{{d.cost8 !=  null ? (d.cost8 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost9',  align: 'center', title: '福利费',rowspan: 2, templet:'<div>{{d.cost9 !=  null ? (d.cost9 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost10',  align: 'center', title: '快递费',rowspan: 2, templet:'<div>{{d.cost10 !=  null ? (d.cost10 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost11',  align: 'center', title: '餐费',rowspan: 2, templet:'<div>{{d.cost11 !=  null ? (d.cost11 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost12',  align: 'center', title: '水电费',rowspan: 2, templet:'<div>{{d.cost12 !=  null ? (d.cost12 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost13',  align: 'center', title: '人身意外伤害险',rowspan: 2, templet:'<div>{{d.cost13 !=  null ? (d.cost13 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost14',  align: 'center', title: '差旅补助',rowspan: 2, templet:'<div>{{d.cost14 !=  null ? (d.cost14 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost15',  align: 'center', title: '低值易耗品',rowspan: 2, templet:'<div>{{d.cost15 !=  null ? (d.cost15 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost16',  align: 'center', title: '运输费、仓储费、包装费',rowspan: 2, templet:'<div>{{d.cost16 !=  null ? (d.cost16 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'cost17',  align: 'center', title: '资产折旧',rowspan: 2, templet:'<div>{{d.cost17 !=  null ? (d.cost17 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                                {field: 'costhj',  align: 'center', title: '小计',rowspan: 2, templet:'<div>{{d.costhj !=  null ? (d.costhj / 1).toFixed(2) : ""}}</div>', totalRow: true,style:'background-color: #B7DEE8;',minWidth: 255}
                            ]
                        ],
                        totalRow:true,
                        page:true,
                        done: function () {
                            $("[data-field='gzjbgz']," +
                                "[data-field='gzjj']," +
                                "[data-field='dwfdwxyjylbx']," +
                                "[data-field='dwfdwxyjsybx']," +
                                "[data-field='dwfdwxyjgsbx']," +
                                "[data-field='dwfdwxyjyiliaobx']," +
                                "[data-field='dwfdwxyjbcylbx']," +
                                "[data-field='dwfdwxyjsyjj']," +
                                "[data-field='dwfdwxyjzfgjj']," +
                                "[data-field='dwfdwxyjxgqjj']," +
                                "[data-field='gzqt']").css('display','none');
                            $("[data-field='zjrg']").prop('colspan',1);
                            $("[data-field='cost1']," +
                                "[data-field='cost2']," +
                                "[data-field='cost3']," +
                                "[data-field='cost4']," +
                                "[data-field='cost5']," +
                                "[data-field='cost6']," +
                                "[data-field='cost7']," +
                                "[data-field='cost8']," +
                                "[data-field='cost9']," +
                                "[data-field='cost10']," +
                                "[data-field='cost11']," +
                                "[data-field='cost12']," +
                                "[data-field='cost13']," +
                                "[data-field='cost14']," +
                                "[data-field='cost15']," +
                                "[data-field='cost16']," +
                                "[data-field='cost17']").css('display','none');
                            $("[data-field='zjcl']").prop('colspan',1);
                        }
                    });
                }
            }
        });
        table.on('toolbar(test)', function(obj){
            var Dom1 = $("button[lay-event=CheckHideData1]");
            var Dom2 = $("button[lay-event=CheckHideData2]");
            if (obj.event == "CheckHideData1") {
                if (Dom1.html() == "隐藏（直接人工费用）") {
                    Dom1.html("展开（直接人工费用）");
                    $("[data-field='gzjbgz']," +
                        "[data-field='gzjj']," +
                        "[data-field='dwfdwxyjylbx']," +
                        "[data-field='dwfdwxyjsybx']," +
                        "[data-field='dwfdwxyjgsbx']," +
                        "[data-field='dwfdwxyjyiliaobx']," +
                        "[data-field='dwfdwxyjbcylbx']," +
                        "[data-field='dwfdwxyjsyjj']," +
                        "[data-field='dwfdwxyjzfgjj']," +
                        "[data-field='dwfdwxyjxgqjj']," +
                        "[data-field='gzqt']").css('display','none');
                    $("[data-field='zjrg']").prop('colspan',1);
                } else {
                    Dom1.html("隐藏（直接人工费用）");
                    $("[data-field='gzjbgz']," +
                        "[data-field='gzjj']," +
                        "[data-field='dwfdwxyjylbx']," +
                        "[data-field='dwfdwxyjsybx']," +
                        "[data-field='dwfdwxyjgsbx']," +
                        "[data-field='dwfdwxyjyiliaobx']," +
                        "[data-field='dwfdwxyjbcylbx']," +
                        "[data-field='dwfdwxyjsyjj']," +
                        "[data-field='dwfdwxyjzfgjj']," +
                        "[data-field='dwfdwxyjxgqjj']," +
                        "[data-field='gzqt']").css('display','');
                    $("[data-field='zjrg']").prop('colspan',12);
                }
            }
            if (obj.event == "CheckHideData2") {
                if (Dom2.html() == "隐藏（直接材料——含其他非人工直接费用）") {
                    Dom2.html("展开（直接材料——含其他非人工直接费用）");
                    $("[data-field='cost1']," +
                        "[data-field='cost2']," +
                        "[data-field='cost3']," +
                        "[data-field='cost4']," +
                        "[data-field='cost5']," +
                        "[data-field='cost6']," +
                        "[data-field='cost7']," +
                        "[data-field='cost8']," +
                        "[data-field='cost9']," +
                        "[data-field='cost10']," +
                        "[data-field='cost11']," +
                        "[data-field='cost12']," +
                        "[data-field='cost13']," +
                        "[data-field='cost14']," +
                        "[data-field='cost15']," +
                        "[data-field='cost16']," +
                        "[data-field='cost17']").css('display','none');
                    $("[data-field='zjcl']").prop('colspan',1);
                } else {
                    Dom2.html("隐藏（直接材料——含其他非人工直接费用）");
                    $("[data-field='cost1']," +
                        "[data-field='cost2']," +
                        "[data-field='cost3']," +
                        "[data-field='cost4']," +
                        "[data-field='cost5']," +
                        "[data-field='cost6']," +
                        "[data-field='cost7']," +
                        "[data-field='cost8']," +
                        "[data-field='cost9']," +
                        "[data-field='cost10']," +
                        "[data-field='cost11']," +
                        "[data-field='cost12']," +
                        "[data-field='cost13']," +
                        "[data-field='cost14']," +
                        "[data-field='cost15']," +
                        "[data-field='cost16']," +
                        "[data-field='cost17']").css('display','');
                    $("[data-field='zjcl']").prop('colspan',18);
                }
            }
        });

    });
}
function projectXmcbmxb(){
    $("#tableTitle").html("项目成本明细表");
    $(".Ygxcmxb").show();
    // $(".bottomTxT_1").html("编制人员：");
    // $(".bottomTxT_2").html("复核人员：");
    // $(".bottomTxT_3").html("主管财务经理：");
    // $(".bottomTxT_4").html("复核日期：");
    // $(".bottomTxT_5").html("主管领导：");
    // $(".bottomTxT_6").html("审批日期：");
    layui.use('table', function(){
        var table = layui.table;
        initTable(table, '项目成本明细表');
        $("#table1+div").show();

        table.render({
            elem: '#table',
            title: '项目成本明细表-人工成本',
            toolbar: true,
            defaultToolbar: ['exports'],
            data:[{}],
            // limits:[10, 20, 50, 100],
            cellMinWidth: 120, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            cols:[
                [ //标题栏
                    { align: 'center', title: '人工成本', colspan: 15},
                ],
                [ //标题栏
                    {field: 'index', align: 'center', title: '序号', totalRowText: '合计'},
                    {field: 'xmbh', align: 'center', title: '身份证号'},
                    {field: 'xm', align: 'center', title: '姓名'},
                    {field: 'xmgs', align: 'center', title: '工时'},
                    {field: 'xmjj', align: 'center', title: '奖金'},
                    {field: 'flf', align: 'center', title: '福利费'},
                    {field: 'flf', align: 'center', title: '养老保险'},
                    {field: 'flf', align: 'center', title: '失业保险'},
                    {field: 'flf', align: 'center', title: '医疗保险'},
                    {field: 'flf', align: 'center', title: '补充医疗保险'},
                    {field: 'flf', align: 'center', title: '工伤保险'},
                    {field: 'flf', align: 'center', title: '生育基金'},
                    {field: 'flf', align: 'center', title: '住房公积金'},
                    {field: 'flf', align: 'center', title: '其他'},
                    {field: 'flf', align: 'center', title: '合计'},
                ]
            ],
            totalRow:true,
            page:true,
        });
        table.render({
            elem: '#table1',
            title: '项目成本明细表-直接费用(非人工)',
            toolbar: true,
            defaultToolbar: ['exports'],
            data:[{
                cost0:'金额',
                cost1:1,
                cost2:21,
                cost3:1,
                cost4:1,
                cost5:1,
                cost6:1,
                cost7:1,
                cost8:1,
                cost9:1,
                cost1:1,
                cost10:1,
                cost11:1,
                cost12:1,
                cost13:1,
                cost14:1,
                cost15:1,
                cost16:1,
                cost17:1,
                costhj:100,
            }],
            // limits:[10, 20, 50, 100],
            cellMinWidth: 120, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            cols:[
                [ //标题栏
                    { align: 'center', title: '直接费用(非人工)', colspan: 15},
                ],[ //标题栏
                    {field: 'cost0', align: 'center', title: '项目'},
                    {field: 'cost1',  align: 'center', title: '材料费',templet:'<div>{{d.cost1 !=  null ? (d.cost1 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost2',  align: 'center', title: '外包服务费',templet:'<div>{{d.cost2 !=  null ? (d.cost2 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost3',  align: 'center', title: '房屋租赁费',templet:'<div>{{d.cost3 !=  null ? (d.cost3 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost4',  align: 'center', title: '差旅费',templet:'<div>{{d.cost4 !=  null ? (d.cost4 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost5',  align: 'center', title: '交通费',templet:'<div>{{d.cost5 !=  null ? (d.cost5 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost6',  align: 'center', title: '办公费',templet:'<div>{{d.cost6 !=  null ? (d.cost6 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost7',  align: 'center', title: '通讯费',templet:'<div>{{d.cost7 !=  null ? (d.cost7 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost8',  align: 'center', title: '劳务费',templet:'<div>{{d.cost8 !=  null ? (d.cost8 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost9',  align: 'center', title: '福利费',templet:'<div>{{d.cost9 !=  null ? (d.cost9 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost10',  align: 'center', title: '快递费',templet:'<div>{{d.cost10 !=  null ? (d.cost10 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost11',  align: 'center', title: '餐费',templet:'<div>{{d.cost11 !=  null ? (d.cost11 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost12',  align: 'center', title: '水电费',templet:'<div>{{d.cost12 !=  null ? (d.cost12 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost13',  align: 'center', title: '人身意外伤害险',templet:'<div>{{d.cost13 !=  null ? (d.cost13 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost14',  align: 'center', title: '差旅补助',templet:'<div>{{d.cost14 !=  null ? (d.cost14 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost15',  align: 'center', title: '低值易耗品',templet:'<div>{{d.cost15 !=  null ? (d.cost15 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost16',  align: 'center', title: '运输费、仓储费、包装费',templet:'<div>{{d.cost16 !=  null ? (d.cost16 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'cost17',  align: 'center', title: '资产折旧',templet:'<div>{{d.cost17 !=  null ? (d.cost17 / 1).toFixed(2) : ""}}</div>', totalRow: true},
                    {field: 'costhj',  align: 'center', title: '小计',templet:'<div>{{d.costhj !=  null ? (d.costhj / 1).toFixed(2) : ""}}</div>', totalRow: true,style:'background-color: #B7DEE8;',minWidth: 255}
                ],
            ],
        });
        /*$.ajax({
            type: 'POST',
            url: '/report/xmcbmxb.json',
            dataType:"json",
            contentType: "application/json; charset=utf-8",
            success: function(result){
                if(result.success){
                    // var cols = col1.concat(col2, col3, col4);
                    console.log(result);
                    var  data = result.data.map((item,index) => {
                        item.index = index + 1;
                        for (var i in item.model) {
                            if (typeof item.model[i] == 'string'){
                                item[i] = item.model[i]
                            } else {
                                var num = item.model[i] !=  null ? (item.model[i] / 1).toFixed(2) : "";
                                if (i == 'hj') {
                                    item['costhj'] = num / 1
                                } else {
                                    item[i] = num / 1
                                }

                            }
                        }
                        return item
                    });
                    var length = data.length;

                }
            }
        });*/


    });
}
/*function projectXmcbgihzb(){
    $("#tableTitle").html("项目成本归集汇总表");
    $(".Ygxcmxb").show();
    $(".bottomTxT_1").html("编制人员：");
    $(".bottomTxT_2").html("复核人员：");
    $(".bottomTxT_3").html("主管财务经理：");
    $(".bottomTxT_4").html("复核日期：");
    $(".bottomTxT_5").html("主管领导：");
    $(".bottomTxT_6").html("审批日期：");
    layui.use('table', function(){
        var table = layui.table;
        table.render({
            elem: '#table',
            data:[{
                id:1,
                IDnumber:4129221111111111,
                name:"XXX",
                totalWorkingHours:"15",
                projectNum1:"11",
                projectNum2:"22",
                projectNum3:"33",
                projectNum4:"44",
                projectNum5:"55",
                projectNum6:"66",
            },{
                id:2,
                IDnumber:412922222222222,
                name:"YYYY",
                totalWorkingHours:"20",
                projectNum1:"22",
                projectNum2:"33",
                projectNum3:"44",
                projectNum4:"55",
                projectNum5:"66",
                projectNum6:"77",
            }],
            cellMinWidth: 120, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            cols:[
                [ //标题栏
//					  		{field:'', title:'ID', width:80, fixed: 'left', unresize: true, sort: true, totalRowText: '合计'},
                    {field: 'id', align: 'center', title: '序号：', rowspan: 2, totalRowText: '合计'},
                    {field: 'projectNum', align: 'center', title: '项目编号：', rowspan: 2},
                    {field: 'projectName', align: 'center', title: '项目名称：', rowspan: 2},
                    {align: 'center', title: '直接人工', colspan: 12},
                    {align: 'center', title: '直接材料（含其他非人工直接费用）', colspan: 9},
                    {field: 'projectNum1', align: 'center', title: '合计', rowspan: 2},
                    {field: 'projectNum1', align: 'center', title: '备注', rowspan: 2},
                ],
                [
                    {field: 'projectNum1', align: 'center', title: '工资',totalRow:true},
                    {field: 'projectNum2', align: 'center', title: '奖金',totalRow:true},
                    {field: 'projectNum3', align: 'center', title: '福利费',totalRow:true},
                    {field: 'projectNum4', align: 'center', title: '养老保险',totalRow:true},
                    {field: 'projectNum5', align: 'center', title: '失业保险',totalRow:true},
                    {field: 'projectNum6', align: 'center', title: '医疗保险',totalRow:true},
                    {field: 'projectNum6', align: 'center', title: '补充医疗保险'},
                    {field: 'projectNum6', align: 'center', title: '工伤保险'},
                    {field: 'projectNum6', align: 'center', title: '生育基金'},
                    {field: 'projectNum6', align: 'center', title: '住房公积金'},
                    {field: 'projectNum4', align: 'center', title: '其他'},
                    {field: 'projectNum5', align: 'center', title: '小计'},
                    {field: 'projectNum6', align: 'center', title: '材料费'},
                    {field: 'projectNum6', align: 'center', title: '外包服务费'},
                    {field: 'projectNum6', align: 'center', title: '房屋租赁费'},
                    {field: 'projectNum6', align: 'center', title: '差旅费'},
                    {field: 'projectNum6', align: 'center', title: '交通费'},
                    {field: 'projectNum6', align: 'center', title: '办公费'},
                    {field: 'projectNum6', align: 'center', title: '通讯费'},
                    {field: 'projectNum6', align: 'center', title: '劳务费'},
                    {field: 'projectNum6', align: 'center', title: '小计'},
                ],
            ],
            totalRow:true,
        });
        $.ajax({
            type: 'POST',
            url: '/report/xmcbmxb.json',
            dataType:"json",
            contentType: "application/json; charset=utf-8",
            success: function(result){
                if(result&&result.success){

                }
            }
        })
    });
}*/


